package com.helloworld.demo.threadbase;

import java.util.concurrent.locks.LockSupport;

public class ThreadLockSupport {
    public static void main(String[] args) {
        Thread thread = new Thread(new ParkThread());
        thread.start();
        System.out.println("唤醒parkThread");
        //唤醒指定线程，提供许可
        LockSupport.unpark(thread);
    }


}

class ParkThread implements Runnable{

    @Override
    public void run() {
        System.out.println("park.. start 等待许可.....");
        //等待”许可“
        LockSupport.park();
        System.out.println("park.. end  执行完成....");
    }
}
